<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('业务流转步骤列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <input type="hidden" name="versionId" id="versionId" th:value="${versionId}"/>
            <input type="hidden" name="flowName" id="flowName" th:value="${flowName}"/>
            <form id="formId">
                <input type="hidden" name="instanceId" th:value="${instanceId}"/>
                <div class="select-list">
                    <ul>
                        <li>
                            <label>状态：</label>
                            <select name="sts" class="selectpicker"
                                    th:with="type=${@dict.getType('sys_notice_status')}">
                                <option value="">所有</option>
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                                        th:value="${dict.dictValue}"></option>
                            </select>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">

        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var stsDatas = [[${@dict.getType('sys_notice_status')}]];
    var prefix = ctx + "busiflw/waittask";

    $(function () {
        var options = {
            url: prefix + "/taskStepList",
            modalName: "业务流转步骤",
            columns: [{
                checkbox: true
            }, {
                field: 'taskBatchId',
                title: '任务批次号'
            },
                {
                    field: 'instanceId',
                    title: '实例号'
                },
                {
                    field: 'tracestepId',
                    title: '业务步骤编号'
                },

                {
                    field: 'stepName',
                    title: '流程步骤'
                },
                {
                    field: 'createTime',
                    title: '创建时间'
                },
                {
                    field: 'stopTime',
                    title: '结束时间'
                },
                {
                    field: 'userName',
                    title: '处理人'
                },
                {
                    field: 'approvDesc',
                    title: '处理意见'
                },
                {
                    field: 'approveMemo',
                    title: '意见说明'
                },
                {
                    field: 'sts',
                    title: '状态 ',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(stsDatas, value);
                    }
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="dealWithWaitTask(\'' + row.instanceId + '\',\'' + row.stepId + '\')"><i class="fa fa-edit"></i>详情</a> ');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });

    function dealWithWaitTask(instanceId, stepId) {
        var versionId = $("#versionId").val();
        var versionId = $("#versionId").val();
        var flowName = $("#flowName").val();
        var url = ctx + "businessFlow/closedWaitTask/" + versionId + "/" + instanceId + "/" + stepId;
        $.modal.openTab(flowName, url);
    }

</script>
</body>
</html>